package org.exercise6.flyWeight;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Stranger
 * @version 1.0
 * @description: TODO
 * @date 2022/11/16 21:54
 */
public class ChatFactory {
    private static final Map<String, Statement> map = new HashMap<>();

    private ChatFactory() {
        ChatStatement chatStatement = new ChatStatement();
        chatStatement.setStatement("Flyweight");
        map.put("Flyweight", chatStatement);
    }

    private static class Holder {
        public static final ChatFactory chat = new ChatFactory();
    }

    public static ChatFactory getInstance() {
        return Holder.chat;
    }

    public Statement getStatement(String key) {
        return map.get(key);
    }

}
